package com.god530.androidutils.utils;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.usage.UsageStats;
import android.app.usage.UsageStatsManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;

/**
 * 功能:旨在将设置类的方法放在这里,作为公共用
 * <li>小米手机调用适配</li>
 * <li>乐视手机调用适配</li>
 * <li>华为手机手机调用适配</li>
 * @author Adrian.20151112
 */
public class SystemUtils {


	private static SystemUtils instance = null;

	public static SystemUtils getInstance() {
		if (instance == null) {
			instance = new SystemUtils();
		}
		return instance;
	}

	private SystemUtils(){}

	
	//@@@手机测试util专区@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	/**
	 * <uses-permission android:name="android.permission.GET_TASKS" />
	 * @param context
	 * @return
	 */
	public static String getCurrentActivityName(Context context) {
		ActivityManager am = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE);


		// get the info from the currently running task
		List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);

		ComponentName componentInfo = taskInfo.get(0).topActivity;
		return componentInfo.getClassName();
	}


	//@@@手机测试util专区@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


}
